package cn.itcast.service.stat.impl;

import cn.itcast.dao.stat.StatDao;
import cn.itcast.service.stat.StatService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class StatServiceImpl implements StatService {

    @Autowired
    private StatDao statDao;


    //获取厂家的销售数据
    @Override
    public List<Map<String, Object>> getFactoryData(String companyId) {
        return statDao.getFactoryData(companyId);
    }



    //统计每小时访问人数
    @Override
    public List<Map<String, Object>> getOnLineData() {
        return statDao.getOnLineData();
    }

    //产品的销售额前五名
    @Override
    public List<Map<String, Object>> getSellData(String companyId) {
        return statDao.getSellData(companyId);
    }

    //获取地域厂家的数量
    @Override
    public List<List<Map<String, Object>>> getFactoryNumber() {
        ArrayList<List<Map<String, Object>>> list = new ArrayList<>();
        List<Map<String,Object>> productFactory = statDao.getFactoryNumberByType("货物");
        List<Map<String,Object>> eProductFactory = statDao.getFactoryNumberByType("附件");
        list.add(productFactory);
        list.add(eProductFactory);
        return list;
    }

}
